#include <objc/runtime.h>
#include <stdio.h>

void fcopy( FILE *fout, FILE *fin);

int main(int argc, char *argv[ ])
{ 
    printf("begin to copy content from %s to %s\n", argv[2], argv[1]);
    FILE *out, *in;
    if(argc!=3){
        printf("args is reqired 3, recieved %d.\n", argc);
        return -1;
    }
    printf("open file %s\n", argv[2]);
    if((in=fopen(argv[2], "rb"))==NULL) {          /* 打开输入文件 */
        printf("file not found\n");
        return -1;
    }
    out=fopen(argv[1], "wb");                     /*out=____;   建立输出文件 */
    fcopy(out, in);
    fclose(in);
    fclose(out);
}

void fcopy( FILE *fout, FILE *fin)                                /* 复制文件内容 */
{ 
    char ch;
    do{
        ch=fgetc(fin);
        if(feof(fin)){
            break;
        }
        fputc(ch,  fout);                       /*fputc(____);*/
    }while(1);
}
